<template>
    <div>
        <a-modal
         v-model:visible="visible" 
         title="编辑信息" 
         @ok="handleOk"
         @cancel="visible = false"
         :width="900"
         :forceRender="true"
        >
            <div class="editImportantInfo-modal-box-v">
                <table border bordercolor="#d9d9d9" style="width: 100%;">
                    <tr>
                        <td class="title-left-v">
                            <div style="display: flex;align-items: center;text-align: center;justify-content: center;">
                                <span class="production-tips-box">*</span>
                                <span>审评时间</span>
                            </div>
                        </td>
                        <td >
                            <a-range-picker
                            :key="inspectKey"
                            :allowClear="false"
                            :defaultValue="[
                                currentRow.fcykssj?moment(currentRow.fcykssj).format('YYYY-MM-DD'):'',
                                currentRow.fcyjssj?moment(currentRow.fcyjssj).format('YYYY-MM-DD'):'']" 
                            @change="onChangeInspect" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title-left-v">
                            <div style="display: flex;align-items: center;text-align: center;justify-content: center;">
                                <span class="production-tips-box">*</span>
                                <span>审评地点</span>
                            </div>
                        </td>
                        <td >
                            <a-textarea 
                                placeholder="请输入审评地点"
                                v-model:value="currentRow.fjcdd"
                                :autosize="{ minRows: 1, maxRows: 10000 }"
                            ></a-textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="title-left-v">
                            <div style="display: flex;align-items: center;text-align: center;justify-content: center;">
                                <span class="production-tips-box">*</span>
                                <span>审评范围</span>
                            </div>
                        </td>
                        <td>
                            <a-textarea 
                                placeholder="请输入审评范围"
                                v-model:value="currentRow.fcyjcfw"
                                :autosize="{ minRows: 1, maxRows: 10000 }"
                            ></a-textarea>
                        </td>
                    </tr>
                    <tr >
                        <td class="title-left-v">注册地址</td>
                        <td>
                            <a-textarea 
                                placeholder="请输入注册地址"
                                v-model:value="currentRow.fqyzszcdz"
                                :autosize="{ minRows: 1, maxRows: 3 }"
                            ></a-textarea>
                        </td>
                    </tr>
                    <tr >
                        <td class="title-left-v">生产地址</td>
                        <td>
                            <a-textarea 
                                placeholder="请输入生产地址"
                                v-model:value="currentRow.fxxdz"
                                :autosize="{ minRows: 1, maxRows: 3 }"
                            ></a-textarea>
                        </td>
                    </tr>
                </table>
                
            </div>
            <template slot="footer" >
                <div style="display: flex;justify-content: flex-end;align-items: center;" >
                    <div style="color: #ed5565;font-weight:600;" >（注意：修改信息成功后，请手动修改审评材料相关文件）</div>
                    <a-button @click="visible = false" style="margin-right: 10px;">取消</a-button>
                    <a-button @click="handleOk" class="blue-btn">确定</a-button>
                </div>
            </template>
        </a-modal>
    </div>
</template>
<script>
import { spcysaveFlow, } from "./service/index";
import compSelector from '@/components/compSelector/compSelector'
import moment from 'moment'
export default {
    components:{
        compSelector,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            currentRow:{},
            fdqrdxnrKey:null,
            moment:moment,
            inspectKey:null,
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        getData(row){
            this.currentRow = row
            this.inspectKey = Date.now()
        },
        onChangeInspect(val,val1){
            //console.log(val,val1)
            this.currentRow.fcykssj = val1[0]
            this.currentRow.fcyjssj = val1[1]
        },
        handleOk(){
            //console.log(this.currentRow)
            var that = this
            if(!this.currentRow.fjcdd){
                this.$message.warning('请输入审评地点')
                return false
            }
            if(!this.currentRow.fcyjcfw){
                this.$message.warning('请输入审评范围')
                return false
            }
            let data = {
                jobid:this.currentRow.jobid,
                sqsxid:this.currentRow.sqsxid,
                opinion:'',
                smgflag:'否',
                map:{
                    fcykssj:this.currentRow.fcykssj,
                    fcyjssj:this.currentRow.fcyjssj,
                    fjcdd:this.currentRow.fjcdd,
                    fcyjcfw:this.currentRow.fcyjcfw,
                    fqyzszcdz:this.currentRow.fqyzszcdz,
                    fxxdz:this.currentRow.fxxdz,
                }
            }
            this.$confirm({
                title:'您确认要修改信息吗？',
                content: (
                    <p style="color:#ed5565;font-weight:600;">注意：修改信息成功后，请手动修改审评材料相关文件</p>
                ),
                onOk() {
                    spcysaveFlow(data).then(res=>{
                        if(res.code == 200){
                            that.$message.success(res.message)
                            that.visible = false
                            that.$emit('editImportantInfoSuccess',that.currentRow)
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                },
                
            });
            
            
        },

    }
}
</script>
<style lang="less">
.editImportantInfo-modal-box-v{
    td{
        padding: 5px;
        height: 30px;
    }
    .title-left-v{
        text-align: center;
        width: 160px;
        font-weight: 600;
        font-size: 16px;
        background-color:#e6f7ff;
        font-family: simHei;
        color: rgba(0, 0, 0, 0.85);
        .production-tips-box{
            color: #ed5565;
            font-size: 14px;
            line-height: 30px;
            padding-right: 5px;
        }
    }
}
</style>